// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Requests;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using Elastic.Transport;
using Elastic.Transport.Extensions;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.Nodes;

public sealed partial class HotThreadsRequestParameters : RequestParameters
{
	/// <summary>
	/// <para>
	/// If true, known idle threads (e.g. waiting in a socket select, or to get
	/// a task from an empty queue) are filtered out.
	/// </para>
	/// </summary>
	public bool? IgnoreIdleThreads { get => Q<bool?>("ignore_idle_threads"); set => Q("ignore_idle_threads", value); }

	/// <summary>
	/// <para>
	/// The interval to do the second sampling of threads.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Interval { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("interval"); set => Q("interval", value); }

	/// <summary>
	/// <para>
	/// Period to wait for a connection to the master node. If no response
	/// is received before the timeout expires, the request fails and
	/// returns an error.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("master_timeout"); set => Q("master_timeout", value); }

	/// <summary>
	/// <para>
	/// Number of samples of thread stacktrace.
	/// </para>
	/// </summary>
	public long? Snapshots { get => Q<long?>("snapshots"); set => Q("snapshots", value); }

	/// <summary>
	/// <para>
	/// The sort order for 'cpu' type (default: total)
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.ThreadType? Sort { get => Q<Elastic.Clients.Elasticsearch.Serverless.ThreadType?>("sort"); set => Q("sort", value); }

	/// <summary>
	/// <para>
	/// Specifies the number of hot threads to provide information for.
	/// </para>
	/// </summary>
	public long? Threads { get => Q<long?>("threads"); set => Q("threads", value); }

	/// <summary>
	/// <para>
	/// Period to wait for a response. If no response is received
	/// before the timeout expires, the request fails and returns an error.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>
	/// The type to sample.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.ThreadType? Type { get => Q<Elastic.Clients.Elasticsearch.Serverless.ThreadType?>("type"); set => Q("type", value); }
}

/// <summary>
/// <para>
/// This API yields a breakdown of the hot threads on each selected node in the cluster.
/// The output is plain text with a breakdown of each node’s top hot threads.
/// </para>
/// </summary>
public sealed partial class HotThreadsRequest : PlainRequest<HotThreadsRequestParameters>
{
	public HotThreadsRequest()
	{
	}

	public HotThreadsRequest(Elastic.Clients.Elasticsearch.Serverless.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.NodesHotThreads;

	protected override HttpMethod StaticHttpMethod => HttpMethod.GET;

	internal override bool SupportsBody => false;

	internal override string OperationName => "nodes.hot_threads";

	/// <summary>
	/// <para>
	/// If true, known idle threads (e.g. waiting in a socket select, or to get
	/// a task from an empty queue) are filtered out.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public bool? IgnoreIdleThreads { get => Q<bool?>("ignore_idle_threads"); set => Q("ignore_idle_threads", value); }

	/// <summary>
	/// <para>
	/// The interval to do the second sampling of threads.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Interval { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("interval"); set => Q("interval", value); }

	/// <summary>
	/// <para>
	/// Period to wait for a connection to the master node. If no response
	/// is received before the timeout expires, the request fails and
	/// returns an error.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("master_timeout"); set => Q("master_timeout", value); }

	/// <summary>
	/// <para>
	/// Number of samples of thread stacktrace.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public long? Snapshots { get => Q<long?>("snapshots"); set => Q("snapshots", value); }

	/// <summary>
	/// <para>
	/// The sort order for 'cpu' type (default: total)
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.ThreadType? Sort { get => Q<Elastic.Clients.Elasticsearch.Serverless.ThreadType?>("sort"); set => Q("sort", value); }

	/// <summary>
	/// <para>
	/// Specifies the number of hot threads to provide information for.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public long? Threads { get => Q<long?>("threads"); set => Q("threads", value); }

	/// <summary>
	/// <para>
	/// Period to wait for a response. If no response is received
	/// before the timeout expires, the request fails and returns an error.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>
	/// The type to sample.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.ThreadType? Type { get => Q<Elastic.Clients.Elasticsearch.Serverless.ThreadType?>("type"); set => Q("type", value); }
}

/// <summary>
/// <para>
/// This API yields a breakdown of the hot threads on each selected node in the cluster.
/// The output is plain text with a breakdown of each node’s top hot threads.
/// </para>
/// </summary>
public sealed partial class HotThreadsRequestDescriptor : RequestDescriptor<HotThreadsRequestDescriptor, HotThreadsRequestParameters>
{
	internal HotThreadsRequestDescriptor(Action<HotThreadsRequestDescriptor> configure) => configure.Invoke(this);

	public HotThreadsRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId))
	{
	}

	public HotThreadsRequestDescriptor()
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.NodesHotThreads;

	protected override HttpMethod StaticHttpMethod => HttpMethod.GET;

	internal override bool SupportsBody => false;

	internal override string OperationName => "nodes.hot_threads";

	public HotThreadsRequestDescriptor IgnoreIdleThreads(bool? ignoreIdleThreads = true) => Qs("ignore_idle_threads", ignoreIdleThreads);
	public HotThreadsRequestDescriptor Interval(Elastic.Clients.Elasticsearch.Serverless.Duration? interval) => Qs("interval", interval);
	public HotThreadsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Serverless.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);
	public HotThreadsRequestDescriptor Snapshots(long? snapshots) => Qs("snapshots", snapshots);
	public HotThreadsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.ThreadType? sort) => Qs("sort", sort);
	public HotThreadsRequestDescriptor Threads(long? threads) => Qs("threads", threads);
	public HotThreadsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Serverless.Duration? timeout) => Qs("timeout", timeout);
	public HotThreadsRequestDescriptor Type(Elastic.Clients.Elasticsearch.Serverless.ThreadType? type) => Qs("type", type);

	public HotThreadsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.Serverless.NodeIds? nodeId)
	{
		RouteValues.Optional("node_id", nodeId);
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
	}
}